import Vue from 'vue'
import Router from 'vue-router'


// 路由懒加载
const top = () => import('@/components/top');
const homePage = () => import("@/pages/homePages/homePage")
const diantai = () => import("@/pages/diantai/diantai");
// mv
const mv = () => import("@/pages/mv/mv")

// 首页
const recommend = () => import("@/pages/homePages/homeSort/recom");
const gedan = () => import("@/pages/homePages/homeSort/gedan");
const newAudio = () => import("@/pages/homePages/homeSort/newAudio");
const rank = () => import("@/pages/homePages/homeSort/rank");
const singer = () => import("@/pages/homePages/homeSort/singer");
const newSing = () => import("@/pages/homePages/homeSort/newSing")

// 搜索
const search = () => import("@/pageDetails/searchResult")

// 搜索详情
const searchSongs = () => import("@/pageDetails/result/songs")
const searchSinger = () => import("@/pageDetails/result/singer")
const searchAlbums = () => import("@/pageDetails/result/albums")
const searchGedan = () => import("@/pageDetails/result/gedan")
const searchMv = () => import("@/pageDetails/result/mv")


// 详情
const gedanDetail = () => import("@/pageDetails/gedan");
const mvDetail = () => import("@/pageDetails/mv")
const singerDetail = () => import("@/pageDetails/singer")
const albumDetail = () => import("@/pageDetails/album")

// 歌曲播放
const playMusic = () => import("@/components/playMusic")

Vue.use(Router)

export default new Router({
  mode: "hash",
  routes: [{
      path: '/',
      name: 'top',
      component: top,
      redirect: "/homePage",
      children: [{
          path: '/homePage',
          name: 'homePage',
          component: homePage,
          redirect: "/homePage/recommend",
          children: [{
              path: "recommend",
              name: "recommend",
              component: recommend,
            },
            {
              path: "gedan",
              name: "gedan",
              component: gedan,
            },
            {
              path: "gdDetail",
              name: "gdDetail",
              component: gedanDetail,
            },
            {
              path: "newAudio",
              name: "newAudio",
              component: newAudio,
            }, {
              path: "rank",
              name: "rank",
              component: rank,
            }, {
              path: "singer",
              name: "singer",
              component: singer,
            },
            {
              path: "singerDetail",
              name: "singerDetail",
              component: singerDetail,
            },
            {
              path: "album",
              name: "album",
              component: albumDetail,
            }, {
              path: "newSing",
              name: "newSing",
              component: newSing
            }
          ]
        },
        {
          path: "diantai",
          name: "diantai",
          component: diantai,
        },
        {
          path: "mv",
          name: "mv",
          component: mv,
        },
        {
          path: "/mv/mvDetail",
          name: "mvDetail",
          component: mvDetail
        },
        {
          path: "search",
          name: "search",
          component: search,
          redirect: "/search/songs",
          children: [{
              path: "songs",
              name: "searchSongs",
              component: searchSongs
            },
            {
              path: "singer",
              name: "searchSinger",
              component: searchSinger
            },
            {
              path: "albums",
              name: "searchAlbums",
              component: searchAlbums,
            },
            {
              path: "gedan",
              name: "searchGedan",
              component: searchGedan,
            },
            {
              path: "mv",
              name: "searchMv",
              component: searchMv
            }
          ]
        },

      ],
    },
    {
      path: "player",
      name: "player",
      component: playMusic
    }

  ]

})
